﻿#pragma once
#include "SelectionManager.h"

// 获取Actor信息
struct ActorInfo
{
    PickMode mode;
    std::string name;
    int index;
};

class ActorManager
{
public:
    ActorManager();
    ~ActorManager();

    // 添加Actor到相应分类
    void AddActor(vtkActor* actor, PickMode mode);
    void RemoveActor(vtkActor* actor); // 移除Actor

    // 获取分类的Actor集合
    vtkActorCollection* GetVolumeActors() const;
    vtkActorCollection* GetFaceActors() const;
    vtkActorCollection* GetEdgeActors() const;
    vtkActorCollection* GetPointActors() const;

    PickMode GetActorMode(vtkActor* actor) const; // 获取Actor的模式
    int AddActor(vtkActor* actor, PickMode mode, const std::string& name); // 添加Actor并返回索引
    ActorInfo GetActorInfo(vtkActor* actor) const;
    std::vector<vtkActor*> GetAllActors() const;// 获取所有Actor
    vtkActor* FindActorByName(const std::string& name) const; // 根据名称查找Actor
    int GetActorCount(PickMode mode) const;  // 获取分类的Actor数量


private:
    std::string GenerateActorName(PickMode mode, int index) const;

    vtkSmartPointer<vtkActorCollection> m_volumeActors;
    vtkSmartPointer<vtkActorCollection> m_faceActors;
    vtkSmartPointer<vtkActorCollection> m_edgeActors;
    vtkSmartPointer<vtkActorCollection> m_pointActors;
    std::unordered_map<vtkActor*, ActorInfo> m_actorInfoMap;

};

std::shared_ptr<ActorManager> GetActorManagerInstance();